
const state = {
  httpRequestList: []
};

const mutations = {
  SET_REQUESE: (state, payload) => {
    if (payload === 0) {
      // 强行中断时才向下执行
      state.httpRequestList.forEach(item => {
        item("interrupt"); // 给个标志，中断请求
      });
      state.httpRequestList = [];
    } else {
      state.httpRequestList.push(payload);
    }
  }
};

const actions = {
  async removeHttpRequestList(ctx) {
    ctx.commit("SET_REQUESE", 0);
  }

};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};

